#include "CInverseBlock.h"
#include "CCamera.h"
#include "CGame.h"
#include "SGD Wrappers/CSGD_Direct3D.h"
#include "SGD Wrappers/CSGD_DirectInput.h"

CInverseBlock::CInverseBlock()
{
	m_nType = OBJ_INVERSE;
}

void CInverseBlock::Update(float fElapsedTime)
{
	if(CSGD_DirectInput::GetInstance()->KeyPressed(DIK_4))
	{
		SetIsActive(!GetIsActive());
	}
}

void CInverseBlock::Render()
{
	if((CCamera::GetInstance()->GetCameraPosX() < (GetPosX() + GetWidth())) && (CCamera::GetInstance()->GetCameraPosY() < (GetPosY() + GetHeight())) &&
		((CCamera::GetInstance()->GetCameraPosX() + CGame::GetInstance()->GetScreenWidth()) > GetPosX()) &&
		((CCamera::GetInstance()->GetCameraPosY() + CGame::GetInstance()->GetScreenHeight()) > GetPosY()))
	{
		RECT temp = GetCollisionRect();
		temp.top -= CCamera::GetInstance()->GetCameraPosY();
		temp.left -= CCamera::GetInstance()->GetCameraPosX();
		temp.bottom -= CCamera::GetInstance()->GetCameraPosY();
		temp.right -= CCamera::GetInstance()->GetCameraPosX();

		if(m_bIsWhite)
			CSGD_Direct3D::GetInstance()->DrawRect(temp, 255,255,255);
		else
			CSGD_Direct3D::GetInstance()->DrawRect(temp, 0,0,0);
	}
}